{extend name="../../admin/view/main"}

{block name="button"}

{if isset($type) and $type eq 'all'}
<!--{if auth("add")}-->
<button data-modal='{:url("add")}' data-title="添加链接" class='layui-btn layui-btn-sm layui-btn-primary'>添加链接</button>
<!--{/if}-->
<!--{if auth("remove")}-->
<a data-confirm="确定要删除这些链接吗？" data-action='{:url("remove")}' data-rule="id#{key}" data-csrf="{:systoken('remove')}" class='layui-btn layui-btn-sm layui-btn-danger'>批量删除</a>
<!--{/if}-->
{else}
<!--{if auth("recover")}-->
<a data-confirm="确定要恢复这些链接吗？" data-action='{:url("recover")}' data-rule="id#{key}" data-csrf="{:systoken('recover')}" class='layui-btn layui-btn-sm layui-btn'>批量恢复</a>
<!--{/if}-->
{/if}

{/block}

{block name="content"}
<div class="layui-tab layui-tab-card think-bg-white">
    <ul class="layui-tab-title">
        {foreach ['all'=>'正常数据','recycle'=>'回 收 站'] as $k=>$v}
        {if isset($type) and $type eq $k}
        <li data-open="{:url('index')}?type={$k}" class="layui-this">{$v}</li>
        {else}
        <li data-open="{:url('index')}?type={$k}">{$v}</li>
        {/if}
        {/foreach}
    </ul>
    <div class="layui-tab-content think-box-shadow">
        {include file='link/index_search'}
        <table class="layui-table margin-top-10" lay-skin="line">
            {notempty name='list'}
            <thead>
            <tr>
                <th class='list-table-check-td think-checkbox'>
                    <label><input data-auto-none data-check-target='.list-check-box' type='checkbox'></label>
                </th>
                <th class='list-table-sort-td'>
                    <button type="button" data-reload class="layui-btn layui-btn-xs">刷 新</button>
                </th>
                <th class='text-left nowrap' width="180px">站点标题</th>
                <th class='text-left nowrap' width="150px">站点URL</th>
                <th class='text-left nowrap'>站点描述</th>
                <th>站长</th>
                <th>创建时间</th>
                <th>操作</th>
            </tr>
            </thead>
            {/notempty}
            <tbody>
            {foreach $list as $key=>$vo}
            <tr data-dbclick>
                <td class='list-table-check-td think-checkbox'>
                    <label><input class="list-check-box" value='{$vo.id}' type='checkbox'></label>
                </td>
                <td class='list-table-sort-td'>
                    <label><input data-action-blur="{:request()->url()}" data-value="id#{$vo.id};action#sort;sort#{value}" data-loading="false" value="{$vo.sort}" class="list-sort-input"></label>
                </td>
                <td class='text-left nowrap'>
                   {$vo.name}
                </td>
                <td class='text-left nowrap'>
                    {$vo.url}
                </td>
                <td class='text-left nowrap'>
                    {$vo.description}
                </td>
                <td class='text-left nowrap'>
                    {$vo.webmaster}
                </td>
                <td class='text-left nowrap'>
                    {$vo.create_at|format_datetime}
                </td>
                <td class='text-left nowrap'>
                    {if isset($type) and $type eq 'all'}
                    <!--{if auth("edit")}-->
                    <a data-dbclick class="layui-btn layui-btn-sm" data-title="编辑链接" data-modal='{:url("edit")}?id={$vo.id}'>编 辑</a>
                    <!--{/if}-->
                    <!--{if auth("remove")}-->
                    <a class="layui-btn layui-btn-sm layui-btn-danger" data-confirm="确定要永久删除此链接吗？" data-action="{:url('remove')}" data-value="id#{$vo.id}" data-csrf="{:systoken('remove')}">删 除</a>
                    <!--{/if}-->
                    {else}
                    <!--{if auth("recover") and $vo.is_deleted eq 1}-->
                    <a class="layui-btn layui-btn-sm layui-btn-warm" data-confirm="确定要恢复该链接吗？" data-action="{:url('recover')}" data-value="id#{$vo.id};is_deleted#0" data-csrf="{:systoken('recover')}">恢 复</a>
                    <!--{/if}-->
                    {/if}
                </td>
            </tr>
            {/foreach}
            </tbody>
        </table>
        {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
    </div>
</div>
{/block}
